package com.etc.service.impl;


import com.etc.dao.FavoritePersonageDao;
import com.etc.dao.HistoryPersonageDao;
import com.etc.pojo.Favorite;
import com.etc.pojo.History;
import com.etc.service.FavoritePersonageService;
import com.etc.service.HistoryPersonageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HistoryPersonageServiceImpl implements HistoryPersonageService {

    @Autowired
    HistoryPersonageDao historyPersonageDao;

    @Override
    public PageInfo<History> queryAllHistoryByUserId(String userId, Integer date, Integer pageNum) {
        PageHelper.startPage(pageNum,6);
        List<History> histories = historyPersonageDao.queryAllHistoryByUserId(userId, date);
        PageInfo<History> historyPageInfo = new PageInfo<>(histories);
        return historyPageInfo;
    }

    @Override
    public boolean deleteHistoryByVideoId(Integer historyId) {
        int leep = historyPersonageDao.deleteHistoryByVideoId(historyId);
        return leep>0;
    }
}
